#pragma once
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <memory>
#include <functional>

#include <connection/udp.hpp>

namespace udp_proxy{

class Proxy{
public:
    Proxy();
    ~Proxy();
    void load_config(std::string cfg_file);
    void add_connection(std::string host_in, uint16_t port_in, std::string host_out, uint16_t port_out);

    void connect();

struct UdpConfig{
    std::string local_host;
    uint16_t local_port;
    std::string remote_host;
    uint16_t remote_port;
};
struct ConnectPair{
    UdpConfig in;
    UdpConfig out;
    std::shared_ptr<ConnUdp> udp_in;
    std::shared_ptr<ConnUdp> udp_out;
};

    friend std::ostream& operator <<(std::ostream &str, Proxy::UdpConfig const &cfg);

private:
    std::fstream _fs;

    std::vector<ConnectPair> cfg_list;
};
}